home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmTest23
- BorderStyle = 0 'None
- Caption = "Implements IsgPaintSink"
- ClientHeight = 3048
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 3504
- LinkTopic = "Form1"
- ScaleHeight = 3048
- ScaleWidth = 3504
- ShowInTaskbar = 0 'False
- StartUpPosition = 3 'Windows Default
- Begin VB.CheckBox chkPaint
- Caption = "Paint on the forms frame (simple)"
- Height = 192
- Left = 180
- TabIndex = 0
- Top = 300
- Width = 2952
- End
- Attribute VB_Name = "frmTest23"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Implements IsgPaintSink
- Private Sub chkPaint_Click()
- If chkPaint.Value = 1 Then
- frmMain.g_wndForm.SetPaintCallback Me
- frmMain.g_wndForm.Redraw rdw_ERASENOW + rdw_FRAME + rdw_INVALIDATE + rdw_UPDATENOW
- Else
- frmMain.g_wndForm.SetPaintCallback Nothing
- frmMain.g_wndForm.Redraw rdw_ERASENOW + rdw_FRAME + rdw_INVALIDATE + rdw_UPDATENOW
- End If
- End Sub
- Private Sub IsgPaintSink_ClientPaint(ByVal hdc As Long, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long)
- ' Do not paint on the client area
- ' Let form do it's default painting
- End Sub
- Private Sub IsgPaintSink_FramePaint(ByVal hdc As Long)
- Debug.Print hdc
- Dim HWND As Long
- HWND = frmMain.HWND
- ' Get window size
- Dim rcSize As RECT
- GetWindowRect HWND, rcSize
- ' Get caption rectangle
- Dim rcCaption As RECT
- Dim nBorder%
- nBorder = GetSystemMetrics(SM_CXFRAME)
- rcCaption.left = nBorder - 1
- rcCaption.top = nBorder - 1
- rcCaption.right = rcSize.right - rcSize.left - nBorder + 1
- rcCaption.bottom = rcCaption.top + GetSystemMetrics(SM_CYCAPTION) - 1
- ' Create font
- Dim hOldFont As Long
- Dim font As New StdFont
- font.Bold = True
- font.name = "Arial"
- font.Size = 12#
- Dim f As IFont
- Set f = font
- ' Draw some extra text on the caption
- hOldFont = SelectObject(hdc, f.hFont)
- SetTextColor hdc, GetSysColor(COLOR_CAPTIONTEXT)
- rcCaption.right = rcCaption.right - GetSystemMetrics(SM_CXSMICON) - 10
- DrawText hdc, "Simple Frame Paint Example", -1, rcCaption, DT_SINGLELINE + DT_VCENTER + DT_RIGHT
- SelectObject hdc, hOldFont
- End Sub
- Private Function IsgPaintSink_GetFlags() As sgWindow.PaintFlag
- ' In this example we are painting over the standard caption bar.
- IsgPaintSink_GetFlags = pfFramePaint + pfFrameAfterDefault
- End Function
-